﻿using System;
using System.Collections.ObjectModel;

namespace JTLeigh.Commerce.Spencer.Core.Common.Entities
{

	/// <summary>
	/// <see langword="abstract"/> base class for all relations classes.
	/// </summary>
	/// <typeparam name="TAssociation">An association class inheriting from 
	/// <see cref="AssociationBase"/>.</typeparam>
	/// <typeparam name="TDisassociation">A disassociation class inheriting from
	/// <see cref="DisassociationBase"/>.</typeparam>
	public abstract class RelationsBase<TAssociation, TDisassociation>
		where TAssociation : AssociationBase
		where TDisassociation : DisassociationBase
	{

		#region Constructors

		/// <summary>
		/// Initializes a new instance of the <see cref="RelationsBase{TAssociation, TDisassociation}"/> 
		/// class, creating the <see cref="Associations"/> and <see cref="Disassociations"/> 
		/// collections.
		/// </summary>
		protected RelationsBase()
		{
			Associations = new Collection<TAssociation>();
			Disassociations = new Collection<TDisassociation>();
		}

		#endregion // Constructors

		#region Properties

		/// <summary>
		/// Gets the collection of associations.
		/// </summary>
		/// <value>A <see cref="Collection{TElement}"/> of <typeparamref name="TAssociation"/>.</value>
		public Collection<TAssociation> Associations { get; private set; }

		/// <summary>
		/// Gets the collection of disassociations.
		/// </summary>
		/// <value>A <see cref="Collection{TElement}"/> of <typeparamref name="TDisassociation"/>.</value>
		public Collection<TDisassociation> Disassociations { get; private set; }

		#endregion // Properties

	}

}
